Socket
Socket
Sign inDemoInstall

@ambassify/fetch-api

Package Overview
Dependencies
7
Maintainers
3
Versions
22
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ambassify/fetch-api


Version published
Maintainers
3
Created

Readme

Source

fetch-api

CircleCI npm version npm downloads maintainer

Small class to create easy to use API clients with fetch. It uses @ambassify/fetch under the hood to provide a default fetch implementation for browser and node.

Usage

Install the package in your project:

npm install --save @ambassify/fetch-api

In your code:

const FetchApi = require('@ambassify/fetch-api');

const api = new FetchApi({
    baseUrl: 'https://your-api.test',
    contentType: 'FORM',
});

api.get('/foo', { offset: 1, limit: 1 })
    .then(res => console.log(res.body))
    .catch(err => console.log(err));

api.post('/foo', { foo: 'bar' });
api.put('/foo/1', { foo: 'bar' });
api.patch('/foo/1', { foo: 'bar' });
api.delete('/foo/1');

Keywords

FAQs

Last updated on 08 Jun 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc